class Pet:  #宠物类
    def __init__(self, name, species, price):
        self.name = name        # 宠物名称
        self.species = species  # 宠物种类
        self.price = price      # 宠物价格

    def display(self): #显示宠物的信息
        return f"名称: {self.name}, 种类: {self.species}, 价格: {self.price}元"

class PetStore: #宠物商店类
    def __init__(self):
        self.inventory = []  # 存储宠物的库存

    def add_pet(self, pet): #添加宠物到库存
        self.inventory.append(pet)

    def sell_pet(self, pet_name): #销售宠物
        for pet in self.inventory:
            if pet.name == pet_name:
                self.inventory.remove(pet)
                return f"{pet_name} 已售出，价格为 {pet.price}元"
        return f"没有找到名为 {pet_name} 的宠物"

    def display_inventory(self):
        """显示库存中的所有宠物"""
        if not self.inventory:
            return "库存为空"
        return "\n".join(pet.display() for pet in self.inventory)

if __name__ == "__main__":
    store = PetStore()
    
    # 添加宠物
    dog = Pet("金猪", "狗", 300)
    cat = Pet("哈吉米", "猫", 250)  
    store.add_pet(dog)
    store.add_pet(cat)
    
    # 显示库存
    print("当前库存:")
    print(store.display_inventory())
    # 销售宠物
    print(store.sell_pet("金猪"))
    # 再次显示库存
    print("更新后的库存:")
    print(store.display_inventory())
